//
//  DNSettingVC.swift
//  LunalerApp
//
//  Created by 露乐ios on 2018/3/12.
//  Copyright © 2018年 露乐ios. All rights reserved.
//

import UIKit

class DNSettingVC: DNBaseViewController {

    @IBOutlet weak var iconImageView: UIImageView!
    
    @IBOutlet weak var versionLabel: UILabel!
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }
    
    override func initUI() {
        self.navigationController?.navigationBar.isHidden = false
        self.title = "设置"
        
        self.iconImageView.layer.cornerRadius = 17.0
        self.iconImageView.clipsToBounds = true
        
        let versionStr = "当前版本号：V" as NSString
        self.versionLabel.text = versionStr.appending(dnNullStrable(str: DNAppContext.shareInstance.appVersion) as String)
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationController?.setNavigationBarHidden(false, animated: false)
//        self.navigationController?.navigationBar
        
        
    }
    

    @IBAction func bindWeChatAction(_ sender: UITapGestureRecognizer) {
        debugPrint("bindWeChatAction")
    }
    
    @IBAction func fixPasswordAction(_ sender: UITapGestureRecognizer) {
        debugPrint("fixPasswordAction")
        let vc = DNReSetPWDVC.defaultViewController()
        self.navigationController?.pushViewController(vc, animated: true)
    }
    

    @IBAction func feedBackAction(_ sender: UITapGestureRecognizer) {
        debugPrint("feedBackAction")
    }
    
    @IBAction func quitLoginAction(_ sender: UITapGestureRecognizer) {
        debugPrint("quitLoginAction")
        let alertVC = UIAlertController.init(title: "提示", message: "确认退出登录?", preferredStyle: .alert)
    
        let cancleAlertAction = UIAlertAction.init(title: "取消", style: .cancel) { (action:UIAlertAction) in
            alertVC.dismiss(animated: true, completion: nil)
        }
        
        let doneAlertAction = UIAlertAction.init(title: "确定", style: .default) { (action:UIAlertAction) in
            DNUserContext.sharedInstance.cleanUserInfo()
            DNTabbarViewController.shareInstance.backToUserSetIndex(index: 0, isShowLoginVC: true, loginSuccessBlock: nil, showLoginVCStyle: nil)
        }
        
        alertVC.addAction(cancleAlertAction)
        alertVC.addAction(doneAlertAction)
        
        self.navigationController?.present(alertVC, animated: true, completion: nil)
        
    }
    
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
